package com.miao.edu.user.service;

import com.miao.edu.user.service.impl.OAuthRemoteServiceFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 调用 spring-oauth 自带的接口来生成token
 */
@FeignClient(name = "edu-oauth-boot",fallback = OAuthRemoteServiceFallback.class)
public interface UserOauthRemoteService {

    @GetMapping("/oauth/token")
    String createToken(@RequestParam("username") String phone,
                       @RequestParam("password") String password,
                       @RequestParam("scope") String scope,
                       @RequestParam("grant_type") String grantType,
                       @RequestParam("client_id") String clientId,
                       @RequestParam("client_secret") String clientSecret,
                       @RequestParam(value = "auth_type", required = false) String authType);

    @GetMapping("/oauth/token")
    String refreshToken(@RequestParam("refresh_token") String refreshToken,
                        @RequestParam("grant_type") String grantType,
                        @RequestParam("client_id") String clientId,
                        @RequestParam("client_secret") String clientSecret);
}
